package com.irdstudio.efp.report.service.impl;

import com.irdstudio.basic.framework.core.base.FrameworkService;
import com.irdstudio.efp.report.service.dao.RptAccLoanStatisticDao;
import com.irdstudio.efp.report.service.facade.RptAccLoanStatisticService;
import com.irdstudio.efp.report.service.vo.RptAccLoanStatisticTempVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 需求编号:2020D0554
 * 问题编号:
 * 开发人员: wengqw
 * 创建日期:2020/6/16
 * 功能描述:
 * 修改日期:2020/6/16
 * 修改描述:
 */
@Service("rptAccLoanStatisticService")
public class RptAccLoanStatisticServiceImpl implements RptAccLoanStatisticService, FrameworkService {

    private static Logger logger = LoggerFactory.getLogger(RptAccLoanStatisticServiceImpl.class);

    @Autowired
    private RptAccLoanStatisticDao rptAccLoanStatisticDao;

    @Override
    public int insert(RptAccLoanStatisticTempVO rptAccLoanStatisticTempVO){
        logger.info("开始插入度小满、马上金融联合贷款未结清贷款统计报表临时表");
        int num;
        try {
            num = rptAccLoanStatisticDao.insert(rptAccLoanStatisticTempVO);
        } catch (Exception e) {
            e.printStackTrace();
            String errorMsg = "插入度小满、马上金融联合贷款未结清贷款统计报表临时表：" + e.getMessage();
            logger.error(errorMsg);
            num = -1;
        }
        return num;
    }

    @Override
    public int deletByDateAndChannelCode(String channelCode){
        logger.info("删除度小满、马上金融联合贷款未结清贷款统计报表临时表旧数据");
        int num;
        try {
            num = rptAccLoanStatisticDao.deletByDateAndChannelCode(channelCode);
        } catch (Exception e) {
            e.printStackTrace();
            String errorMsg = "删除度小满、马上金融联合贷款未结清贷款统计报表临时表：" + e.getMessage();
            logger.error(errorMsg);
            num = -1;
        }
        return num;
    }
}
